﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace QuestPrototype
{
    class MouseCursor
    {
        #region MouseCursor members
        const int CURSOR_SIZE = 50;
        Dictionary<string, Texture2D> cursors;
        Texture2D currentCursor;
        Rectangle position;
        Color color;

        #endregion

        #region MouseCursor constructors
        public MouseCursor(Dictionary<string, Texture2D> _cursors, Color _color)
        {
            this.position = new Rectangle(0, 0, CURSOR_SIZE, CURSOR_SIZE);
            this.cursors = _cursors;
            this.color = _color;
            this.currentCursor = _cursors["normal"];
        }
        #endregion

        #region MouseCursor methods

        public bool changeCursor(string newCursor)
        {
            if (!cursors.TryGetValue(newCursor, out currentCursor))
            {
                return false;
            }
            return true;
        }

        public void Update(GameTime gameTime)
        {
            MouseState mouse_state = Mouse.GetState();
            position.X = mouse_state.X;
            position.Y = mouse_state.Y;
        }

        public void Draw(SpriteBatch sb)
        {
            sb.Draw(currentCursor, position, color);
        }
        #endregion
    }
}
